package com.itheima.test;

import java.util.Scanner;

//ctrl+alt+l  格式化代码
//ctrl+alt+m  自动抽取方法
public class Test1 {
    public static void main(String[] args) {
        //需求：机票价格按照淡季旺季,头等舱和经济舱收费，输入机票原价，月份和头等舱或经济舱
        //按照如下规则计算机票价格：旺季（5-10月）头等舱9折，经济舱8.5折，淡季（11-4月）头等舱7折，经济舱6.5折
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入您的机票原价：");
        int price = sc.nextInt();
        System.out.println("请输入当前的年份：");
        int month = sc.nextInt();
        System.out.println("请输入您的机舱类型：(0表示头等舱，1表示经济舱)");
        int seat = sc.nextInt();
        if (month >= 5 && month <= 10) {
            if (seat == 0) {
                price = (int) (price * 0.9);
            } else if (seat == 1) {
                price = (int) (price * 0.85);
            } else {
                System.out.println("不存在这个舱位！");
            }
        } else if ((month >= 1 && month <= 4) || (month >= 11 && month <= 12)) {
            if (seat == 1) {
                price = (int) (price * 0.7);
            } else if (seat == 1) {
                price = (int) (price * 0.65);
            } else {
                System.out.println("不存在这个舱位！");
            }
        } else {
            System.out.println("不存在这个月份！");
        }
        System.out.println("您的机票价格为：" + price);
    }
}
